def count_keyword(log_file,target):
    count = 0
    with open(log_file,"r",encoding="utf-8") as f:
        for line in f:
            count += line.count(target)
    print(f"关键词{target}出现次数{count}")



count_keyword("app.log","error")

